<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="/modelo/padrao.xhtml">
        <ui:define name="conteudo">
           
            <p:panel id="panel" header="Cadastrar Análise">
                
                <h:form id="form_analise">
                    
                    <h:inputHidden id="ih_id" value="#{analiseBean.analise.id}"/>
                    
                    <h:panelGrid columns="3">
                        <span>Análise:</span>
                        <p:inputText id="it_nome" 
                                     value="#{analiseBean.analise.nome}"
                                     size="30"
                                     required="true"
                                     requiredMessage="Campo Obrigatório"
                                     />
                        <p:message id="msg_nome" for="it_nome" />
                        
                        <span>Preço:</span>
                        <p:inputText id="it_preco"
                                     value="#{analiseBean.analise.preco}"
                                     size="11"
                                     required="true"
                                     requiredMessage="Campo Obrigatório"
                                     />
                        <p:message id="msg_preco" for="it_preco" />
                        
                        <span>Tipo:</span>
                        <p:selectOneMenu id="som_tipo"
                                         value="#{analiseBean.analise.tipo}"
                                         required="true"
                                         requiredMessage="Campo Obrigatório"
                                         >

                            <f:selectItem itemLabel="Selecione" noSelectionOption="true" />
                            <f:selectItem itemValue="PLANTA" itemLabel="Planta"/>
                            <f:selectItem itemValue="SOLO" itemLabel="Solo"/>
                        </p:selectOneMenu>
                        <p:message id="msg_tipo" for="som_tipo"/>
                    </h:panelGrid>
                    
                    <p>
                        <p:commandButton id="cb_salvar"
                                         ajax="false"
                                         value="Salvar"
                                         action="#{analiseBean.salvar()}"/>
                        <p:button id="bt_cancelar" 
                                  value="Cancelar"
                                  outcome="lista_analise"/>
                    </p>
                </h:form>                
            </p:panel>         
        </ui:define>
    </ui:composition>
</html>

